﻿split_f_val = function (val) {
    var fval = [];
    var last = 0;
    do {
        var arrindex = [];
        var index = -1;
        if (val.indexOf("+") != -1) {
            arrindex.push(val.indexOf("+"));
        }
        if (val.indexOf("-") != -1) {
            arrindex.push(val.indexOf("-"));
        }
        if (val.indexOf("%") != -1) {
            arrindex.push(val.indexOf("%"));
        }
        if (val.indexOf("*") != -1) {
            arrindex.push(val.indexOf("*"));
        }
        if (val.indexOf("/") != -1) {
            arrindex.push(val.indexOf("/"));
        }
        arrindex.sort(function (a, b) { return a - b });
        if (arrindex.length > 0) {
            index = arrindex[0];
        }
        if (parseInt(index) != -1) {
            if (parseInt(index) == 0) {
                var _f_val = (val.substring(0, 1));
                val = val.substring(1, val.length);
                if (_f_val != "") {
                    fval.push(_f_val);
                }
            }
            else {
                var _f_val = (val.substring(0, index));
                val = val.substring(index, val.length);
                if (isNaN(_f_val)) {
                    if (_f_val != "") {
                        fval.push(_f_val);
                    }
                }
                else {
                    if (_f_val != "") {
                        fval.push(_f_val);
                    }
                }
            }
            last = 1;
        }
        else {
            var _f_val = (val.substring(0, val.length));
            if (isNaN(_f_val)) {
                if (_f_val != "") {
                    fval.push(_f_val);
                }
            }
            else {
                if (_f_val != "") {
                    fval.push(_f_val);
                }
            }
            last = 0;
        }
    } while (parseInt(last) > 0)
    return fval;
}
function roundValue(val) {
    var round_val = 0;
    if (!(isNaN(val))) {
        round_val = (Math.round(val * 100)) / 100
    }
    return round_val;
}
function roundValue(val, index) {
    if (isNaN(index)) {
        index = 0;
    }
    var round_val = 0;
    if (!(isNaN(val))) {
        switch (parseInt(index)) {
            case 1:
                round_val = Math.round(val * 10) / 10;
                break;
            case 2:
                round_val = (Math.round(val * 100)) / 100;
                break;
            case 3:
                round_val = Math.round(val * 1000) / 1000;
                break;
            case 4:
                round_val = Math.round(val * 10000) / 10000;
                break;
            case 5:
                round_val = Math.round(val * 100000) / 100000;
                break;
            case 6:
                round_val = Math.round(val * 1000000) / 1000000;
                break;
            case 7:
                round_val = Math.round(val * 10000000) / 10000000;
                break;
            case 8:
                round_val = Math.round(val * 100000000) / 100000000;
                break;
            case 9:
                round_val = Math.round(val * 1000000000) / 1000000000;
                break;
            default:
                round_val = Math.round(val);
        }
    }
    return round_val;
}